home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / programm.ing / gfa / gfacode.arc / PALETTE.LST < prev    next >
Encoding:
File List  |  1990-11-14  |  1.1 KB  |  41 lines

  1. ' Please don't mess up the user's colors!
  2. '
  3. ' ------------- SAVE ORIGINAL COLOR PALETTE -----------------------
  4. '  Run this first
  5. '
  6. PROCEDURE save_pal
  7.   '
  8.   DIM spalette%(16,3)  !  This will hold the user's colors
  9.   '
  10.   FOR z%=0 TO 15
  11.     DPOKE CONTRL,26  !  VDI inquire color function
  12.     DPOKE CONTRL+2,0 !  No PTSIN
  13.     DPOKE CONTRL+6,2 !  Two INTIN's
  14.     DPOKE INTIN,z%   !  Color index
  15.     DPOKE INTIN+2,0  !  We want the color stored here
  16.     VDISYS
  17.     spalette%(z%,0)=DPEEK(INTOUT+2)  !  Red value
  18.     spalette%(z%,1)=DPEEK(INTOUT+4)  !  Green value
  19.     spalette%(z%,2)=DPEEK(INTOUT+6)  !  Blue value
  20.   NEXT z%
  21. RETURN
  22. '
  23. ' --------------------- RESTORES PALETTE -------------------
  24. '  Run this at end of program
  25. '
  26. PROCEDURE restore_pal
  27.   ' Dimensions: Spalette%(16,3)
  28.   '
  29.   FOR z%=0 TO 15
  30.     DPOKE CONTRL,14  !  VDI set color function
  31.     DPOKE CONTRL+2,0 !  No PTSIN
  32.     DPOKE CONTRL+6,4 !  Four INTIN's
  33.     DPOKE INTIN,z%   !  Color index
  34.     DPOKE INTIN+2,spalette%(z%,0)  !  Red value
  35.     DPOKE INTIN+4,spalette%(z%,1)  !  Green value
  36.     DPOKE INTIN+6,spalette%(z%,2)  !  Blue value
  37.     VDISYS
  38.   NEXT z%
  39. RETURN
  40. '
  41.